<?php 
 include_once('taskmodel.php');
 session_start();
    $quantity = $_SESSION['cart_items'][$quantity];

 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="assets/ico/favicon.ico">

    <title>Grocery Express</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/custom.css" rel="stylesheet">
    <link href="assets/css/font-awesome.min.css" rel="stylesheet">


    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    
    <script src="assets/js/modernizr.js"></script>
  </head>

  <body>
    
    <!-- Fixed navbar -->
           <?php 
            //if 
            $loggedin=$_SESSION['loggedin'];
            if($loggedin)
            {
                include('navbarloggedinitems.php');
            }
            else
            {
            include('navigationitems.php');
            }
            ?>
	<!-- *****************************************************************************************************************
	 BLUE WRAP
	 ***************************************************************************************************************** -->
    <div class="container">
			<div class="row" style="margin-top: 65px">
			     <?php
 
        if(isset($_SESSION['cart_items'])){
            //table
            echo "<table class ='table-responsive table-bordered'>";
               echo "<tr>";
               echo "<th class='textAlignLeft'>Product Name</th>";
               echo "<th>Price (PHP)</th>";
               echo "<th>Quantity</th>";
               echo "<th>Total</th>";
               echo "</tr>";

            // get the product ids
            //$ids = "";
            foreach($_SESSION['cart_items'] as $id=>$value){
                //echo $value;
                //$ids = $ids . $id . ",";
                 $results = getProductsInCart($id);
                 $name = $results['productName'];
                 $price=number_format($results['price'],2,'.','');

                    $CostPerProduct = $price * $quantity;
                    $total = $total + $CostPerProduct;
                    
                      // our table heading
                        echo "<tr>";
                             echo "<td>$name</td>";
                             echo "<td>$price</td>";
                             echo "<td>$quantity</td>";
                             echo "<td>$CostPerProduct</td>";
                        echo "</tr>";
            }
            echo "</table>";
        }

        ?>
			</div><!-- /row -->
	    </div> <!-- /container -->
	
       

	<!-- *****************************************************************************************************************
	 FOOTER
	 ***************************************************************************************************************** -->
	 
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
	<script src="assets/js/retina-1.1.0.js"></script>
	<script src="assets/js/jquery.hoverdir.js"></script>
	<script src="assets/js/jquery.hoverex.min.js"></script>
	<script src="assets/js/jquery.prettyPhoto.js"></script>
  	<script src="assets/js/jquery.isotope.min.js"></script>
  	<script src="assets/js/custom.js"></script>


  </body>
</html>
